package com.yyt.securitydemo.dao;

import com.yyt.securitydemo.domain.MyUser;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yeyangtao
 * @since 2022/7/27 16:16
 */
@Component
public class UserDao {
    private List<MyUser> myUserList = new ArrayList<>();

    public MyUser findByUserName(String name) {
        return myUserList.stream().filter(m -> name.equals(m.getUsername())).findFirst().orElse(null);
    }

    public void add(MyUser user) {
        myUserList.add(user);
    }
}
